export default {
  table: 'ie_system_user',
  columns: [
    {
      key: 'id'
    },
    {
      title: '用户账号',
      key: 'username',
      sorter: true
    },
    {
      title: '手机号码',
      key: 'phone',
      nullValue: '无'
    },
    {
      title: '用户角色',
      key: 'ie_system_user_role.rolename',
      nullValue: '注册用户'
    },
    {
      title: '所属部门',
      key: 'system_user_meta.department.name',
      nullValue: '无'
    },
    {
      title: '创建时间',
      key: 'create_at',
      type: 'date',
      sorter: true
    }
  ],
  queryOptions: {
    'ie_system_user_role.id': {
      title: '用户角色',
      type: 'async',
      table: 'ie_system_user_role',
      labelKey: 'rolename',
      valueKey: 'id',
      multiple: true
    },
    'system_user_meta.department.id': {
      title: '所属部门',
      type: 'async',
      table: 'department',
      labelKey: 'name',
      valueKey: 'id',
      multiple: true
    },
    create_at: {
      type: 'daterange',
      format: 'yyyy-MM-dd'
    }
  },
  formInputs: {
    username: {
      rules: [
        { required: true, message: '用户账号不可为空' },
        { min: 6, max: 20, message: '用户账号长度为6-20' },
        { pattern: /^[0-9a-zA-Z_-]+$/, message: '用户账号只能使用数字、英文大小写、下划线、中横线' }
      ]
    },
    password: {
      title: '用户密码',
      type: 'password',
      rules: [
        { required: true, message: '登录密码不可为w空' },
        { min: 6, max: 20, message: '登录密码长度为6-20' }
      ]
    },
    phone: {
      rules: [
        { pattern: /^[0-9]+$/, message: '电话格式不正确' }
      ]
    },
    role_id: {
      title: '用户角色',
      type: 'async',
      table: 'ie_system_user_role',
      labelKey: 'rolename',
      valueKey: 'id'
    }
  }
}
